#include <iostream>
using namespace std;

Residues **support;

/* The main procedure 
 *
 * For any c_{ij} and a \in D_i, create the cache c[i][j].
 *
 */

int main(){

  int method; 

  cout << "Pls input the method to use: ";
  cin >> method;

  // method = 1;

  support = new Residues*[8];

  cout << "initialization ... " << endl;

  for (int i = 0; i < 8; i++){
    try{
      switch(method){
      case 1:
	support[i] = new FIFO_simple;
	break;
      case 2:
	support[i] = new FIFO_full;
      case 3: 
      default:
	support[i] = new FIFO_update;
      }
    }
    catch(bad_alloc){
      cerr << "Fail to new objects." << endl;
    }
  }

  for (int i = 0; i < 8; i++){
    (*support[i]).initialize(2, i, i, i); 
    cout << "i = " << i << endl;
  }

  cout << "initialization is done." << endl;

  for (int i = 0; i < 8; i++)
    (*support[i]).initAdd(i);
}
